package annotation;

import org.apache.commons.beanutils.BeanUtils;
import org.junit.Test;
import ymy.Student;

import java.beans.BeanInfo;
import java.util.HashMap;
import java.util.Map;

/**
 * @author com.ymy.hadoop
 * @date 2018/12/15 15:28
 */
public class BeanUtilsApp {

    @Test
    public void test01() throws Exception{
        Student student = new Student();
        BeanUtils.setProperty(student,"name","若泽");
        System.out.println(student);
    }

    @Test
    public void test02()throws Exception{
        Student student = new Student();

        Map<String,Object> map = new HashMap<String, Object>();
        map.put("name","哈哈");
        map.put("age",30);
        BeanUtils.populate(student,map);

        System.out.println(student);
    }
}
